TryAdd Method

Task Parallel System.Threading

Attempts to add an object to the IProducerConsumerCollection<(Of <(T>)>).

Namespace:  System.Collections.Concurrent
Assembly:  System.Threading (in System.Threading.dll)

Syntax

Visual Basic (Declaration)
Function TryAdd ( _
	item As T _
) As Boolean
C#
bool TryAdd(
	T item
)

Parameters

item
Type: T
The object to add to the IProducerConsumerCollection<(Of <(T>)>).

Return Value

true if the object was added successfully; otherwise, false.

Exceptions

ExceptionCondition
System..::.ArgumentExceptionThe item was invalid for this collection.

See Also